package com.atom.module.mvvm.base

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.KeyEvent
import androidx.fragment.app.Fragment

interface ApiFragment {


    interface OnNewIntentListener {
        /**
         * Called at the . The default implementation check intent extra and load fragment, but you can
         * implement this interface on your fragment to do whatever you want.
         *
         * @param intent The new intent that was started for the activity.
         * @return true if you handled this event, false if you want activity handled this event.
         */
        fun onNewIntent(bundle: Bundle?): Boolean
    }

    interface OnBackPressedListener {
        /**
         * Called when the activity has detected the user's press of the back key. The default implementation simply finishes the current activity, but you can
         * implement this interface on your fragment to do whatever you want.
         *
         * @return true if you handled this event, false if you want activity handled this event.
         */
        fun onBackPressed(): Boolean
    }

    interface OnFinishListener {
        /**
         * call at activity finish,implement this interface on your fragment to do whatever you want.
         *
         * @return true continue call [Activity.finish]. return false break activity finish
         */
        fun onFinish(): Boolean
    }

    interface OnKeyPressedListener : KeyEvent.Callback

    interface OnMenuPressedListener {
        /**
         * Called when the activity has detected the user's press of the menu key. You can implement this interface on your fragment to do whatever you want.
         */
        fun onMenuPressed()
    }
}
